﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;

namespace RiskMan.DataClass.BaseTransaqCalss
{
    internal class FortsPosition : INotifyPropertyChanged
    {
        #region Private

        private int _secid;
        private List<int> _markets;
        private string _seccode;
        private string _client;
        private int _startnet;
        private double _openbuys;
        private double _opensells;
        private double _totalnet;
        private double _todaybuy;
        private double _todaysell;
        private double _optmargin;
        private double _varmargin;
        private double _expirationpos;
        private double _usedsellspotlimit;
        private double _sellspotlimit;
        private double _netto;
        private double _kgo;

        #endregion

        #region Public

        /// <summary>
        /// Код инструмента
        /// </summary>
        public int Secid
        {
            get { return _secid; }
            set
            {
                if (_secid != value)
                {
                    _secid = value;
                    RaisePropertyChanged("Secid");
                }
            }
        }

        /// <summary>
        /// Внутренний код рынка
        /// </summary>
        public List<int> Markets
        {
            get { return _markets; }
            set
            {
                if (_markets != value)
                {
                    _markets = value;
                    RaisePropertyChanged("Markets");
                }
            }
        }

        /// <summary>
        /// Идентификатор клиента
        /// </summary>
        public string Client
        {
            get { return _client; }
            set
            {
                if (_client != value)
                {
                    _client = value;
                    RaisePropertyChanged("Client");
                }
            }
        }

        /// <summary>
        /// Код инструмента
        /// </summary>
        public string Seccode
        {
            get { return _seccode; }
            set
            {
                if (_seccode != value)
                {
                    _seccode = value;
                    RaisePropertyChanged("Seccode");
                }
            }
        }

        /// <summary>
        /// Входящая позиция по инструменту
        /// </summary>
        public int ShorStartnettname
        {
            get { return _startnet; }
            set
            {
                if (_startnet != value)
                {
                    _startnet = value;
                    RaisePropertyChanged("Startnet");
                }
            }
        }

        /// <summary>
        /// В заявках на покупку
        /// </summary>
        public double Openbuys
        {
            get { return _openbuys; }
            set
            {
                if (_openbuys != value)
                {
                    _openbuys = value;
                    RaisePropertyChanged("Openbuys");
                }
            }
        }

        /// <summary>
        /// В заявках на продажу
        /// </summary>
        public double Opensells
        {
            get { return _opensells; }
            set
            {
                if (_opensells != value)
                {
                    _opensells = value;
                    RaisePropertyChanged("Opensells");
                }
            }
        }

        /// <summary>
        /// Текущая позиция по инструменту
        /// </summary>
        public double Totalnet
        {
            get { return _totalnet; }
            set
            {
                if (_totalnet != value)
                {
                    _totalnet = value;
                    RaisePropertyChanged("Totalnet");
                }
            }
        }

        /// <summary>
        /// Куплено
        /// </summary>
        public double Todaybuy
        {
            get { return _todaybuy; }
            set
            {
                if (_todaybuy != value)
                {
                    _todaybuy = value;
                    RaisePropertyChanged("Todaybuy");
                }
            }
        }

        /// <summary>
        /// Продано
        /// </summary>
        public double Todaysell
        {
            get { return _todaysell; }
            set
            {
                if (_todaysell != value)
                {
                    _todaysell = value;
                    RaisePropertyChanged("Todaysell");
                }
            }
        }

        /// <summary>
        /// Маржа для маржируемых опционов
        /// </summary>
        public double Optmargin
        {
            get { return _optmargin; }
            set
            {
                if (_optmargin != value)
                {
                    _optmargin = value;
                    RaisePropertyChanged("Optmargin");
                }
            }
        }

        /// <summary>
        /// Вариационная маржа
        /// </summary>
        public double Varmargin
        {
            get { return _varmargin; }
            set
            {
                if (_varmargin != value)
                {
                    _varmargin = value;
                    RaisePropertyChanged("Varmargin");
                }
            }
        }

        /// <summary>
        /// Опционов в заявках на исполнение
        /// </summary>
        public double Expirationpos
        {
            get { return _expirationpos; }
            set
            {
                if (_expirationpos != value)
                {
                    _expirationpos = value;
                    RaisePropertyChanged("Expirationpos");
                }
            }
        }

        /// <summary>
        /// Объем использованого спот-лимита на продажу
        /// </summary>
        public double Usedsellspotlimit
        {
            get { return _usedsellspotlimit; }
            set
            {
                if (_usedsellspotlimit != value)
                {
                    _usedsellspotlimit = value;
                    RaisePropertyChanged("Usedsellspotlimit");
                }
            }
        }

        /// <summary>
        /// текущий спот-лимит на продажу, установленный Брокером
        /// </summary>
        public double Sellspotlimit
        {
            get { return _sellspotlimit; }
            set
            {
                if (_sellspotlimit != value)
                {
                    _sellspotlimit = value;
                    RaisePropertyChanged("Sellspotlimit");
                }
            }
        }

        /// <summary>
        /// нетто-позиция по всем инструментам данного спота
        /// </summary>
        public double Netto
        {
            get { return _netto; }
            set
            {
                if (_netto != value)
                {
                    _netto = value;
                    RaisePropertyChanged("Netto");
                }
            }
        }

        /// <summary>
        /// коэффициент ГО для спота
        /// </summary>
        public double Kgo
        {
            get { return _kgo; }
            set
            {
                if (_kgo != value)
                {
                    _kgo = value;
                    RaisePropertyChanged("Kgo");
                }
            }
        }


        #endregion

        #region event PropertyChangedEventHandler

        public event PropertyChangedEventHandler PropertyChanged;

        protected void RaisePropertyChanged(string propertyName)
        {
            var handler = PropertyChanged;
            if (handler != null)
            {
                handler(this, new PropertyChangedEventArgs(propertyName));
            }
        }

        #endregion
    }
}
